package com.xyh.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xyh.po.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author:kyle
 * @Date:2020/12/14 - 16:02
 * @Project:spring_demo1
 * @Package:com.xyh.dao
 * @Version:1.0
 */
//BaseMapper 是dao层接口
@Repository("userMapper")
public interface UserMapper extends BaseMapper<User>{

    @Select("select * from t_user_role " +
            " right join t_user on fk_user_id = id " +
            " right join t_role on fk_role_id = role_pkid " +
            " ${ew.customSqlSegment}")
    @ResultMap("com.xyh.dao.UserMapper.userMap")
    List<User> selectByLinkWrapperPage(@Param(Constants.WRAPPER) Wrapper<User> wrapper);
}
